﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title></title>
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            border: 0;
            width: 100%;
        }
    </style>
</head>
<body>
    <div style="width:100%;">
        <button onclick="location.href = location.href;" type="button">刷新</button>
    </div>
    <div style="width:100%;">
        <div style="text-align: center; margin-top:20px;margin-bottom:10px; font-size: 20px; letter-spacing: 3px; font-weight: bold; " id="container_title">资金统计情况</div>
        <div id="container" style="height: 440px;width:100%;">
        </div>
    </div>
    <div>
        <!--<div id="container1" style="height:500px;">
        </div>-->
    </div>

    <script src="/Scripts/echarts.js" type="text/javascript"></script>
    <script src="/Scripts/Modal.Child.js" type="text/javascript"></script>

    <script src="/Scripts/jquery.1.11.1.js" type="text/javascript"></script>

    <script type="text/javascript">
        if (typeof window.GetRequest != 'undefined') {
            top.MessageBox.Alert("GetRequest参数 属性名已被占用");
        }
        else {

            window.GetRequest = function (ifObj) {
                if (typeof ifObj == 'boolean') {
                    if (ifObj) {
                        var obj = {};
                        obj.Data = GetRequest();
                        obj.QueryString = function (key) {
                            for (var item in obj.Data) {
                                if (item.toLocaleLowerCase() == key.toLocaleLowerCase()) {
                                    return obj.Data[item];
                                }
                            }
                            return '';
                        }
                        return obj;
                    }
                }
                var url = location.search; //获取url中"?"符后的字串
                var theRequest = new Object();
                if (url.indexOf("?") != -1) {
                    var str = url.substr(1);
                    strs = str.split("&");
                    for (var i = 0; i < strs.length; i++) {
                        theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                    }
                }
                return theRequest;
            }
        }
    </script>
    <script type="text/javascript">
        $(function () {

            //FORM_SIZE(900, 850);
            BindData();
            //BindData1();

        })
        //初始化折线图
        function BindData() {
            var dom = document.getElementById("container");
            var myChart = echarts.init(dom);
            var app = {};
            var option = null;
            var parms = {};
            parms.Type = "WEEK_TABLE";
            parms.Data = {};
            parms.Data.ID = GetRequest(true).QueryString("ID");
            if (parms.Data.ID == "") {
                top.MessageBox.Alert("没有接受到参数");
                return;
            }
            option = {
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data: ['计划金额', '银行金额']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        magicType: { show: true, type: ['line', 'bar', 'stack', 'tiled'] },
                        saveAsImage: { show: true }
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                },
                yAxis: {
                    name :"金额（万元）",
                    type: 'value'
                },
                series: [
                {
                    name: '计划金额',
                    type: 'line',
                    data: [120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name: '银行金额',
                    type: 'line',
                    data: [320, 332, 301, 334, 390, 330, 320]
                }]
            }
            $.post("/Module/StatisticalReport/api.ashx", JSON.stringify(parms), function (data) {
                if (!data.Success) {
                    return;
                    top.MessageBox.Alert(data.Meg);
                    return;
                }
                var _data = data.Data;
                $("#container_title").text(data.Entity.C_USEWEEK + "周资金使用情况(单位：万元)");

                option.xAxis.data = [];
                option.series[0].data = [];
                option.series[1].data = [];

              //  alert(_data.length);
                for (var i = 0; i < _data.length; i++) {
                  //  alert(_data[i].N_AMOUNT + "," + _data[i].N_USEAMOUNT + "," + _data[i].C_PRONAME);
                    option.series[0].data.push(_data[i].N_AMOUNT);
                    option.series[1].data.push(_data[i].N_USEAMOUNT);

                    option.xAxis.data.push(_data[i].C_PRONAME);
                }

                myChart.setOption(option);
            });
        }
    </script>
</body>
</html>